package tech.aistar.day02;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 本类功能:转发
 *
 * @author cxylk
 * @date 2020/9/16 17:42
 */
@WebServlet(urlPatterns = "/day02/forward/to")
public class ForwardToAction extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter out=resp.getWriter();

        //从request作用域中获取数据 - 根据作用域中的key
        String name= (String) req.getAttribute("uname");


        out.println("to:"+name);

    }
}
